public class Solution {
    public String dynamicPassword(String password, int target) {
        char[] arr = new char[target];
        char[] tmp = password.toCharArray();
        for (int i = 0; i < target; i++) {
            arr[i] = tmp[i];
        }
        for (int i = 0; i < tmp.length - target; i++) {
            tmp[i] = tmp[i + target];
        }
        int j = 0;
        for (int i = tmp.length - target; i < tmp.length; i++) {
            tmp[i] = arr[j];
            j++;
        }
        return new String(tmp);
    }
}